def evaluate_expression(expression):
    # 移除表达式中的空格
    expression = expression.replace(" ", "")
    # 将表达式中的符号替换为对应的运算符
    expression = expression.replace("++", "+")
    expression = expression.replace("+-", "-")
    expression = expression.replace("-+", "-")
    expression = expression.replace("--", "+")
    # 使用eval函数计算表达式的结果
    return eval(expression)


def find_equations(numbers, target, expression="", result=[]):
    if not numbers:
        if evaluate_expression(expression) == target:
            result.append(expression)
        return
    for i in range(1, len(numbers) + 1):
        current = numbers[:i]
        remaining = numbers[i:]
        if not expression:
            find_equations(remaining, target, current, result)
        else:
            find_equations(remaining, target, expression + "+" + current, result)
            find_equations(remaining, target, expression + "-" + current, result)

    return result


numbers = "987654321"
target = 100
solutions = find_equations(numbers, target)
for solution in solutions:
    result = evaluate_expression(solution)
    print(f"{solution} = {result}")